package com.ibuonline.b2b.entity;

import java.io.Serializable;

public class ShopColumn implements Serializable {

	private static final long serialVersionUID = 4072865785243690058L;

	//fields
	private java.lang.Integer id;
	private java.lang.Integer columnId;
	private java.lang.Integer position;
	private java.lang.Integer companyId;
	private java.lang.String columnName;
	private java.lang.Integer displayOrder;
	private java.lang.Boolean display;
	private java.sql.Timestamp lastupdate;

	//default constructor
	public ShopColumn() {
	}

	//getter
	public java.lang.Integer getId() {
		return id;
	}
	public java.lang.Integer getColumnId() {
		return columnId;
	}
	public java.lang.Integer getPosition() {
		return position;
	}
	public java.lang.Integer getCompanyId() {
		return companyId;
	}
	public java.lang.String getColumnName() {
		return columnName;
	}
	public java.lang.Integer getDisplayOrder() {
		return displayOrder;
	}
	public java.lang.Boolean isDisplay() {
		return display;
	}
	public java.sql.Timestamp getLastupdate() {
		return lastupdate;
	}

	//setter
	public void setId(java.lang.Integer id) {
		this.id = id;
	}
	public void setColumnId(java.lang.Integer columnId) {
		this.columnId = columnId;
	}
	public void setPosition(java.lang.Integer position) {
		this.position = position;
	}
	public void setCompanyId(java.lang.Integer companyId) {
		this.companyId = companyId;
	}
	public void setColumnName(java.lang.String columnName) {
		this.columnName = columnName;
	}
	public void setDisplayOrder(java.lang.Integer displayOrder) {
		this.displayOrder = displayOrder;
	}
	public void setDisplay(java.lang.Boolean display) {
		this.display = display;
	}
	public void setLastupdate(java.sql.Timestamp lastupdate) {
		this.lastupdate = lastupdate;
	}

	//equals method
	public boolean equals(Object other) {
		if (this == other)
			return true;
		if (!(other instanceof ShopColumn))
			return false;

		final ShopColumn shopColumn = (ShopColumn)other;
		if (!this.id.equals(shopColumn.getId()))
			return false;

		return true;
	}

	//hashCode method
	public int hashCode() {
		StringBuffer keys = new StringBuffer();
		keys.append(id).append(",");
		if (keys.length() > 0)
			keys.deleteCharAt(keys.length() - 1);
		return keys.toString().hashCode();
	}

	//toString method
	public String toString() {
		return new StringBuilder("ShopColumn[")
			.append("id=").append(id).append(", ")
			.append("columnId=").append(columnId).append(", ")
			.append("position=").append(position).append(", ")
			.append("companyId=").append(companyId).append(", ")
			.append("columnName=").append(columnName).append(", ")
			.append("displayOrder=").append(displayOrder).append(", ")
			.append("display=").append(display).append(", ")
			.append("lastupdate=").append(lastupdate).append("]").toString();
	}

	///#################
	public String getDefaultName() {
		if (columnId == null)
			return null;
		return com.ibuonline.b2b.common.SysCache.getShopColumnDef(columnId).getName();
	}
	
	public String getUrl(){
		ShopColumnDef temp = com.ibuonline.b2b.common.SysCache.getShopColumnDef(columnId);
		if (temp != null) {
			return temp.getUrl();
		}
		return null;
	}
}
